#ifndef ARTICLELISTER_H
#define ARTICLELISTER_H

#include <QObject>
#include <QJsonObject>

class QNetworkReply;
class QNetworkAccessManager;
class ArticleLister : public QObject
{
    Q_OBJECT
public:
    explicit ArticleLister(QObject *parent = nullptr);

    // 设置请求模式（同步或异步）
    void setSyncMode(bool sync);

    void fetchArticleList();

signals:
    void articleListFetched(const QList<QJsonObject>& articles);
    void fetchFailed(const QString& error);

private slots:
    void onRequestFinished(QNetworkReply* reply);

private:
    QNetworkAccessManager* httpManager;
    bool isSync; // 请求模式标志位
};

#endif // ARTICLELISTER_H
